home *** CD-ROM | disk | FTP | other *** search
/ Gekkan Dennou Club 145 / Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z / Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin / tools / sharp / sxwork3.lzh / サンプル応用編 / イメージ編集 / GIMAGE.H < prev    next >
Text File  |  1994-03-10  |  5KB  |  144 lines

  1. /******************************************************************************
  2.  *    gimage.h:    gimage.c用ヘッダファイル
  3.  ******************************************************************************
  4.  *    Workroom SX-68K Sample Program Copyright 1994 SHARP
  5.  *
  6.  *    定数定義
  7.  */
  8. /* ウィンドウタイトル */
  9. #define WINTITLE    ((_LASCII) "\x0cイメージ編集")
  10.  
  11. /* ウィンドウサイズ */
  12. #define WIN_H        480        /* ウィンドウの幅        */
  13. #define WIN_V        256        /* ウィンドウの高さ        */
  14.  
  15. /* 数値調整ボタンのリピート時間(1/100秒単位)*/
  16. #define ADJFIRST    40        /* リピート開始時間        */
  17. #define ADJNEXT        12        /* リピート間隔            */
  18.  
  19. /* サブウィンドウサイズ */
  20. #define TLSUB_H        140        /* ツールウィンドウの幅        */
  21. #define TLSUB_V        90        /* ツールウィンドウの高さ    */
  22. #define PLSUB_H        168        /* 色選択ウィンドウの幅        */
  23. #define PLSUB_V        68        /* 色選択ウィンドウの高さ    */
  24.  
  25. /* サブウィンドウの表示位置 */
  26. #define TLPOS_X        150        /* ツールウィンドウの左端    */
  27. #define TLPOS_Y        70        /* ツールウィンドウの上端    */
  28. #define PLPOS_X        420        /* 色選択ウィンドウの左端    */
  29. #define PLPOS_Y        70        /* 色選択ウィンドウの上端    */
  30.  
  31. /* 数値調整ボタンの表示位置 */
  32. #define ADJ_X        56        /* X座標            */
  33. #define ADJ_Y        (WS_INSIDE_Y + 2) /* Y座標            */
  34.  
  35. /* サブウィンドウのパートコード */
  36. #define WS_ININSIDE    3        /* サブウィンドウの内側        */
  37. #define WS_INDRAG    4        /* ドラッグリージョン        */
  38. #define WS_INCLOSE    7        /* クローズボタン        */
  39.  
  40. #define CLOSE        -1        /* クローズボタン        */
  41. #define MAIN        -1        /* メインウィンドウ        */
  42. #define TOOL        0        /* ツールウィンドウ        */
  43. #define PALET        1        /* 色選択ウィンドウ        */
  44. #define SUBMAX        2        /* サブウィンドウの数        */
  45.  
  46. /* ビットイメージリソースの開始ID */
  47. #define BRSSTID        128        /* 'PAT2'            */
  48. #define BTNSTID        128        /* 'PAT3'            */
  49. #define COLSTID        128        /* 'PAT4'            */
  50.  
  51. /* イベントマスク */
  52. #define EVENTMASK    (EM_MSLDOWN | EM_MSRDOWN | EM_UPDATE | EM_ACTIVATE | EM_SYSTEM1 | EM_SYSTEM2)
  53. /*
  54.  *    構造体宣言
  55.  */
  56. typedef struct ComVal {            /* 共通変数            */
  57.     Window *windowPtr;        /* ウィンドウポインタ        */
  58.     BOOLEAN activeFlag;        /* アクティブフラグ        */
  59.     TsEvent event;            /* イベントレコード        */
  60.     int eventMask;            /* イベントマスク        */
  61.     int errorCode;            /* エラーコード            */
  62.     BOOLEAN endFlag;        /* 終了フラグ            */
  63.     Subwin *subwinPtr[SUBMAX];    /* サブウィンドウポインタ    */
  64.     Region **subRgnHdl[SUBMAX];    /* サブウィンドウのリージョンハンドル */
  65.     BOOLEAN subActiveFlag[SUBMAX];    /* サブウィンドウのアクティブフラグ */
  66.  
  67.     /* ペン幅調整ボタンのコントロールハンドル */
  68.     Control **adjBtnHdl;
  69.     LASCII adjBtnTtl;        /* ペン幅調整ボタンのタイトル    */
  70.  
  71.     Handle resMap;            /* リソースマップのハンドル    */
  72.     /* サブウィンドウのピクチャーボタン用ビットイメージ */
  73.     RectImg **pctBtnImg[13];
  74.     RectImg **brushImg[2];        /* ブラシ、消しゴム用ビットイメージ */
  75.     RectImg **plBtnImg;        /* パレットボタン用ビットイメージ */
  76.  
  77.     Graph offGraph;            /* オフスクリーン用グラフレコード */
  78.     /* オフスクリーン用グラフ作成完了フラグ */
  79.     BOOLEAN offGraphOK;
  80.     Bits **offBitsHdl;        /* オフスクリーン用ビッツハンドル */
  81.     Graph wkGraph;            /* ワーク用グラフレコード    */
  82.     BOOLEAN wkGraphOK;        /* ワーク用グラフ作成完了フラグ    */
  83.     Bits **wkBitsHdl;        /* ワーク用ビッツハンドル    */
  84.  
  85.     int paletNo;            /* パレット番号            */
  86.     int toolKind;            /* 現在使用中のツールの種類    */
  87.     Point penSize;            /* 描画ペンサイズ        */
  88.     Point radius;            /* ラウンドレクタングルの半径    */
  89. } ComVal;
  90. /*
  91.  *    外部変数宣言
  92.  */
  93. extern Rect brSize;
  94. /*
  95.  *    関数プロトタイプ
  96.  */
  97. /* gimain.c */
  98. BOOLEAN init(ComVal *);
  99. BOOLEAN createWindow(ComVal *);
  100. BOOLEAN createOffScreen(ComVal *);
  101. void msLDownEvent(ComVal *);
  102. void msRDownEvent(ComVal *);
  103. void selectMenu(ComVal *);
  104. void keyDownEvent(ComVal *);
  105. void updateEvent(ComVal *);
  106. void drawGraph(ComVal *);
  107. void activateEvent(ComVal *);
  108. void systemEvent(ComVal *);
  109. void showErrDialog(ComVal *);
  110. void endProc(int, ComVal *);
  111. BOOLEAN loadResource(ComVal *);
  112. void setGraph(ComVal *, int, int);
  113. void repeatAdjBtn(ComVal *, int);
  114.  
  115. /* gimage.c */
  116. void paintPen(ComVal *, LPoint);
  117. void paintRgn(ComVal *, LPoint);
  118. BOOLEAN makeRgn(ComVal *, Point *, int, Rect *);
  119. void paintBrush(ComVal *, LPoint);
  120. void brushing(ComVal *, Region **, Point *, Point *, Point *);
  121. void drawEraser(ComVal *, Rect *);
  122. void paintFig(ComVal *, LPoint);
  123. void drawFig(ComVal *, Rect *);
  124. void makeRect(LPoint, LPoint, Rect *);
  125. void ajustPoint(Point *, Point *);
  126. void ajustEndPoint(LPoint, Point *);
  127.  
  128. /* gisubwin.c */
  129. BOOLEAN createSubwin(ComVal *);
  130. BOOLEAN openSubwin(ComVal *, int);
  131. void closeSubwin(ComVal *, int);
  132. BOOLEAN createSubControl(ComVal *);
  133. void checkSubControl(ComVal *);
  134. int msLDownSubwin(ComVal *, int);
  135. void dragSubwin(ComVal *, LPoint, int);
  136. void drawSubwin(ComVal *, int);
  137. void drawSubTitleBar(ComVal *, int);
  138. void selectPctBtn(ComVal *, int);
  139. void calcPctBtn(int, int, Rect *);
  140. BOOLEAN checkPctBtn(ComVal *, int, int, LPoint);
  141. void changePctBtn(ComVal *, int, int);
  142. void revFillRect(Rect *);
  143. void revFrameRect(Rect *);
  144.